﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UtilZ.Dotnet.Ex.Communication.Net.MQBase
{
    /// <summary>
    /// MQ消息队列工厂基类
    /// </summary>
    public abstract class MQMessageQueueFactoryAbs : IMQMessageQueueFactory
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public MQMessageQueueFactoryAbs()
        {

        }

        /// <summary>
        /// MQ名称
        /// </summary>
        public string Name
        {
            get { return this.GetName(); }
        }
        /// <summary>
        /// 获取MQ名称
        /// </summary>
        /// <returns></returns>
        protected abstract string GetName();


        /// <summary>
        /// 创建消息队列
        /// </summary>
        /// <param name="brokerInfo">MQ连接信息</param>
        public IMQMessageQueue CreateMessageQueue(MQBrokerInfo brokerInfo)
        {
            return this.PrimitveCreateMessageQueue(brokerInfo);
        }

        /// <summary>
        /// 创建消息队列
        /// </summary>
        /// <param name="brokerInfo">MQ连接信息</param>
        /// <returns>消息队列</returns>
        protected abstract IMQMessageQueue PrimitveCreateMessageQueue(MQBrokerInfo brokerInfo);
    }
}
